﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <link type="text/css" rel="stylesheet" media="all" href="../styles/global.css" />
        <link type="text/css" rel="stylesheet" media="all" href="../styles/global_color.css" />
        <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
        <script type="text/javascript" src="/js/main_list.js"></script>
        <script language="javascript" type="text/javascript">
            //保存结果的提示
            function showResult() {
                showResultDiv(true);
                window.setTimeout("showResultDiv(false);", 3000);
            }
            function showResultDiv(flag) {
                var divResult = document.getElementById("save_result_info");
                if (flag)
                    divResult.style.display = "block";
                else
                    divResult.style.display = "none";
            }

        </script>
    </head>
    <body>
        <!--Logo区域开始-->
        <div id="header">
            <img src="../images/logo.png" alt="logo" class="left"/>
            <a href="/login.html">[退出]</a>
        </div>
        <!--Logo区域结束-->
        <!--导航区域开始-->
        <div id="navi">
            <ul id="menu">
                <li><a href="/index.html" class="index_off"></a></li>
                <li id="liBro" style="display: none;"></li>
            </ul>
        </div>
        <!--导航区域结束-->
        <div id="main">      
            <!--保存操作后的提示信息：成功或者失败-->      
            <div id="save_result_info" class="save_success">保存成功！</div><!--保存失败，旧密码错误！-->
            <form action="/info/passModify" method="post" class="main_form">
                <div class="text_info clearfix"><span>旧密码：</span></div>
                <div class="input_info">
                    <input type="password" name="oldPassword" class="width200" value="" placeholder="请输入原密码" /><span class="required">*</span>
                    <div class="validate_msg_medium">注意输入的内容必须是16长度以内的字母、数字和下划线的组合</div>
                </div>
                <div class="text_info clearfix"><span>新密码：</span></div>
                <div class="input_info">
                    <input type="password" name="newPassword" class="width200" value="" placeholder="请输入新密码" /><span class="required">*</span>
                    <div class="validate_msg_medium" >注意输入的内容必须是16长度以内的字母、数字和下划线的组合</div>
                </div>
                <div class="text_info clearfix"><span>重复新密码：</span></div>
                <div class="input_info">
                    <input type="password" name="newPasswordRepeat" class="width200" value="" placeholder="请再次输入新密码" /><span class="required">*</span>
                    <span id="pasOk" style="display: none;color: aquamarine">两次密码输入的一致</span><div class="validate_msg_medium">注意两次新密码必须相同</div>
                </div>
                <div class="button_info clearfix">
                    <input type="submit" value="保存" class="btn_save btn_sub" />
                    <input type="button" value="取消" class="btn_save btn_cancel" />
                </div>
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
            <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
            <p>版权所有(C)云科技有限公司 </p>
        </div>
    </body>
<script>
    $('.btn_sub').click(function () {
        let oldPassword = $('input[name="oldPassword"]').val();
        if (oldPassword == null || oldPassword == '' || oldPassword.length > 16){
            alert('旧密码不能为空,或者最大长度不能超过16');
            return false
        }

        let newPassword = $('input[name="newPassword"]').val();
        if (newPassword == null || newPassword == '' || newPassword.length > 16){
            alert('新密码不能为空,或者最大长度不能超过16');
            return false
        }

        let newPasswordRepeat = $('input[name="newPasswordRepeat"]').val();
        if (newPasswordRepeat == null || newPasswordRepeat == '' || newPasswordRepeat.length > 16){
            alert('确认密码不能为空,或者最大长度不能超过16');
            return false
        }

        if (newPassword != newPasswordRepeat){
            alert('两次密码输入的不一致')
            return false;
        }
        showResult();


    })

    $('.btn_cancel').click(function () {
        window.location.href='/index.html';
    })
</script>
</html>
